﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Blog.TemplateEngine.Filters
{
    class DateFilter : IFilter
    {
        protected string Filter(string input, object parameter)
        {
            DateTime dt;
            if (DateTime.TryParse(input.ToString(), out dt))
            {
                return dt.ToString(parameter.ToString());
            }

            return String.Empty;
        }

        protected bool HasParameter
        {
            get { return true; }
        }

        string IFilter.Filter(string input, object parameter)
        {
            return Filter(input, parameter);
        }

        bool IFilter.HasParameter
        {
            get { return HasParameter; }
        }
    }
}
